package newKe;

//import org.junit.Test;

import java.util.Scanner;

public class HJ33 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String[] arr = sc.nextLine().split("\\.");
        //to 2
        StringBuilder sb = new StringBuilder();
        for(int i=0;i<4;i++){
            int shi = Integer.parseInt(arr[i]);
            String si = String.format("%8s",Integer.toBinaryString(shi)).replace(" ","0");
            sb.append(si);
        }
        System.out.println(Long.parseLong(sb.toString(),2));

        long num =  sc.nextLong();
        String s = String.format("%32s",Long.toBinaryString(num)).replace(" ","0");

        System.out.print(Integer.parseInt(s.substring(0, 8), 2)+".");
        System.out.print(Integer.parseInt(s.substring(8, 16), 2)+".");
        System.out.print(Integer.parseInt(s.substring(16, 24), 2)+".");
        System.out.println(Integer.parseInt(s.substring(24, 32), 2));
    }
}


